package cn.iocoder.ny.module.mall.controller.admin.statistics;

/**
 * @author luchunhong
 * @date 2024/11/13/ 15:12
 * @description:
 */

import cn.iocoder.ny.module.mall.service.IMallOrderService;
import cn.iocoder.ny.module.mall.service.IStatistcsService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 数据统计
 */
@RestController
@RequestMapping("statistics")
public class StatisticsController {
    @Autowired
    private IStatistcsService statistcsService;


    /**
     * 统计销售额+总用户数+总订单数+待核销
     */
    @RequestMapping("queyAnyStatistics")
    public CommonResult getSaleStatistics(){
        //  统计销售额+总用户数+总订单数+待核销
        Map<String, Object> stringObjectMap = statistcsService.querySaleAndUserAndVerificationTotal();
        return CommonResult.success(stringObjectMap);
    }

    /**
     * 统计商城内的商品总数与商品与分类之间的统计
     */
    @RequestMapping("queryProductStatistics")
    public CommonResult getProductStatistics(){
        //  统计商城内的商品总数与商品与分类之间的统计
        Map<String, Object> stringObjectMap = statistcsService.queryProductStatistics();
        return CommonResult.success(stringObjectMap);
    }
    /**
     * 商品销量排行榜
     */
    @RequestMapping("queryProductSaleRank")
    public CommonResult queryProductSaleRank(){
        //  商品销量排行榜
        Map<String, Object> stringObjectMap = statistcsService.queryProductSaleRank();
        return CommonResult.success(stringObjectMap);
    }


}
